<template>
  <div class="paramConfig">
    <DFPageList ref="dfPageListRef" :pageOptions="pageOptions"/>
  </div>
</template>

<script lang="ts" setup name="Parameter">
  import lang from './lang';
  import { pageGatherParameter, addGatherParameter, updateGatherParameter, delGatherParameter } from '@/api/gather/parameter';
  import { useMixins } from '@/hooks/useMixins';

  const { loadLangFn } = useMixins();

  const dfPageListRef: any = ref(null);

  loadLangFn(lang);

  const pageOptions = {
    searchForm: {
      formSchemas: [
        {
          label: 'parameterName',
          component: 'NInput',
        },
        {
          label: 'parameterCode',
          component: 'NInput',
        },
      ],
    },
    table: {
      columns: [
        {
          width: 120,
          label: 'parameterName',
        },
        {
          width: 120,
          label: 'parameterCode',
        },
        {
          width: 120,
          label: 'remark',
          common: true,
        },
      ],
      action: {
        columns: [
          {
            label: 'edit',
          },
          {
            label: 'delete',
          },
        ],
      },
      operaColumn: [
        {
          label: 'add',
        },
      ],
      requestFn: pageGatherParameter,
      delRequestFn: delGatherParameter,
    },
    modalFormDialog: {
      formSchemas: [
        {
          label: 'parameterName',
          // editDialogDisabled: true,
          required: true,
        },
        {
          label: 'parameterCode',
          editDialogDisabled: true,
          required: true,
        },
        {
          label: 'remark',
          common: true,
          type: 'textarea',
        },
      ],
      addDataFn: addGatherParameter,
      updateDataFn: updateGatherParameter,
    },
  };

  // nextTick(() => {
  //   dfPageListRef.value && dfPageListRef.value.openModalFn();
  // });
</script>
